package com.li.shop.service.Impl;

import com.li.shop.domain.Shopcard;
import com.li.shop.domain.ShopcardExample;
import com.li.shop.mapper.ShopcardMapper;
import com.li.shop.service.ShopCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShopCardServiceImpl implements ShopCardService {

    @Autowired
    private ShopcardMapper shopcardMapper;

    @Override
    public int insert(Shopcard shopcard) {
        return shopcardMapper.insert(shopcard);
    }

    @Override
    public int selectByUid(String uid) {
        return shopcardMapper.selectByUid(uid);
    }

    @Override
    public int updateById(Shopcard shopcard) {
        return shopcardMapper.updateByPrimaryKey(shopcard);
    }

    @Override
    public long countByExample(ShopcardExample example) {
        return shopcardMapper.countByExample(example);
    }

    @Override
    public List<Shopcard> searchgoods(String id) {
        return shopcardMapper.searchgoods(id);
    }

    @Override
    public int update(String id) {
        return shopcardMapper.deleteByPid(id);
    }

    @Override
    public List<Shopcard> searchproduct(String uid) {
        return shopcardMapper.searchproduct(uid);
    }

    @Override
    public Shopcard s(String pId) {
        ShopcardExample example=new ShopcardExample();
        example.createCriteria().andPIdEqualTo(pId);
        List<Shopcard>shopcards=shopcardMapper.selectByExample(example);
        return shopcards.get(0);
    }

    @Override
    public int deleteCartShopByPrimaryKey(String id) {
        return shopcardMapper.deleteByPrimaryKey(id);
    }


}
